<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>searchCourses</title>
    <link th:href="@{/webjars/bootstrap/3.4.1/css/bootstrap.css}" rel="stylesheet">
</head>
<body>
<div id="videos" th:each="courseInfo:${courseInfos}">
    <div class="col-sm-6 col-md-3">
        <div class="thumbnail">
            <img src="img/uiz7.jpg" th:src="'/img/img'+${courseInfo.getCourseId()}+'.jpg'"
                 alt="通用的占位符缩略图">
            <div class="caption" th:id="${courseInfo.getCourseId()}">
                <h3><a class="video" href="/video/video1.mp4" th:href="'/video/video'+${courseInfo.getCourseId()}+'.mp4'" th:text="${courseInfo.getCourseName()}">缩略图标签</a></h3>
                <p th:text="${courseInfo.getSpecialty()}">一些示例文本。一些示例文本。</p>
                <button type="button" class="btn btn-primary subscription" value="subscription">收藏</button>
            </div>
        </div>
    </div>
</div>
<script th:src="@{/webjars/jquery/3.4.1/jquery.js}"></script>
<script>
    $(".video").click(function () {
        var courseId = $(this).parent().parent().attr("id");
        $.ajax({
            type:"POST",
            data:{
                "courseId":courseId
            },
            url:"/clickCourseHref"
            // success:function (result) {
            //
            // }
        })
    });

    $(".subscription").click(function () {
        var courseId = $(this).parent().attr("id");
        $.ajax({
            type:"POST",
            data:{
                "courseId":courseId
            },
            url:"/subscriptionClick"
        })
    });


</script>
</body>
</html>